package cn.com.nes.mybatis.agent.system.mapper;

import cn.com.nes.mybatis.agent.system.entity.Company;
import cn.com.nes.site.service.system.company.dto.CompanyTreeNodeDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.Date;
import java.util.List;

public interface CompanyMapper extends BaseMapper<Company> {

    /**
     * 查询正在使用的公司
     * @param companyId
     * @return
     */
    Company getCompanyUnDelete(String companyId);


    /**
     * 查询最后的子公司ID
     * @param pCompanyId
     * @return
     */
    String getLastChildComapnyId(String pCompanyId);


    Company getCompanyByName(String companyFullName);


    void deleteChildCompany(@Param("companyId") String companyId, @Param("operateUserId") Long operateUserId,
            @Param("operateDate") Date operateDate);

    List<Company> getChildCompanys(String companyId);

    List<Company> getCompanys(Page<Company> page, @Param("companyId") String companyId, @Param("companyType") String companyType,@Param("companyName")String companyName);
    List<Company> getExistCompany(@Param("companyName") String companyName,@Param("uniformSocialCreditCode") String uniformSocialCreditCode,@Param("organizationCode") String organizationCode);

    String getCompanyId(@Param("callCenterCompanyId") String callCenterCompanyId);

    Company getCompanyUnDeleted(@Param("companyId") String companyId);

    CompanyTreeNodeDTO getRootCompanyTreeNode(@Param("companyId") String companyId);

    List<CompanyTreeNodeDTO> getCompanyTreeNodeList(@Param("parentId") String parentId);

    int updateCompany(@Param("companyId")String companyId, @Param("callCenterCompanyId")String callCenterCompanyId);

    Collection<String> getCcCompanyIdSet(@Param("companyId") String companyId);
}




